<!-- 自动审批数据库 -->
<template>
	<view class="noticDetails">
		<view class="noticeTitle">{{ messageInfo.title }}</view>
		<view class="usernameAndTime">
			<view class="dateTime">{{ '发布时间: ' + messageInfo.add_time }}</view>
			<view class="username">
				<span>发布人：</span>
				<span>{{ messageInfo.membername }}</span>
			</view>
		</view>
		<scroll-view
			style="width: 100%;margin-top: 15rpx;"
			scroll-y="true"
		>
			<view class="noticeInfo"><u-parse :content="messageInfo.content"></u-parse></view>
		</scroll-view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			token:'',
			member_id:'',
			company_id:'',
			messageInfo: {}
		};
	},
	onPullDownRefresh() {},
	onShow() {},
	onLoad(options) {
		this.token = uni.getStorageSync('btlh_process_token') || ''
		this.member_id = uni.getStorageSync('btlh_process_member_id') || ''
		this.company_id = uni.getStorageSync('bthl_process_LoginCompanyId') || ''
		if(options.id){
			this.getMessageDetails(options.id)
		}
	},
	methods: {
		async getMessageDetails(id){
			const {
				data: res
			} = await this.$myRequest({
				url: 'Management/notice_detail',
				method: 'POST',
				data: {
					member_id: this.member_id,
					token: this.token,
					company_id: this.company_id,
					notice_id: id
				}
			});
			if (res.code != 200)
				return uni.showToast({
					title: res.datas.msg,
					icon: 'none'
				});
			this.messageInfo = res.datas.info;
			this.messageInfo.content = this.messageInfo.content.replace(/\<img/g,'<img style="width:100%;height:auto;display:block"');
		}
	}
};
</script>

<style scoped lang="scss">
.noticDetails {
	background-color: #fff;
	padding: 40rpx 30rpx;
	width: 750rpx;
	height: auto;
	border-radius: 20rpx;
	box-sizing: border-box;
	position: relative;

	.noticeTitle {
		text-align: center;
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #333333;
	}

	.usernameAndTime {
		margin-top: 20rpx;
		display: flex;
		justify-content: space-between;
		font-size: 22rpx;
		color: #666;

		.username {
			color: #128bf1;
		}
	}

	/deep/.noticeInfo {
		margin-top: 30rpx;
		font-size: 24rpx;
		// width: 285rpx;

		color: #666;
	}

	.closeIcon {
		position: absolute;
		top: -70rpx;
		right: 0;
	}
}
</style>
